#include <stdio.h>
#include <wuqi/ByteUtils.h>
#include <unistd.h>
#include "learnString/include/LearnString.h"
#include "learnString/include/LearnFileManager.h"

typedef int *INT;

#define tokenpaster(n) printf ("token" #n " = %d", token##n)
#define MAX(x, y) ((x) > (y) ? (x) : (y))


int main(int argc, char *argv[]) {
    printf("argc is %d \n ", argc);

    for (int i = 0; i < argc; ++i) {
        printf("argv[%d] is %s \n ", i, argv[i]);
    }


    unsigned char ss = '2';
    unsigned char arrayUnsignedChars[100];
    memset(arrayUnsignedChars, 0, sizeof(unsigned char) * 100);
    strcpy(arrayUnsignedChars, "hello");

    char arrayChars[100];
    memset(arrayChars, 0, sizeof(char) * 100);
    strcpy(arrayChars, "hello");

    printf("arrayChars %s \n", arrayChars);
    printf("arrayUnsignedChars %s \n", arrayUnsignedChars);
    int aaa = 101;
    INT sss = &aaa;
    printf("sss %d \n", *sss);

    int *p = malloc(100);

    printf("address %p\n", p);

    free(p);

    printf("File :%s\n", __FILE__);
    printf("Date :%s\n", __DATE__);
    printf("Time :%s\n", __TIME__);
    printf("Line :%d\n", __LINE__);
    printf("ANSI :%d\n", __STDC__);

    //标记粘贴运算符（##）
    //宏定义内的标记粘贴运算符（##）会合并两个参数。它允许在宏定义中两个独立的标记被合并为一个标记
    int token34 = 40;
    tokenpaster(34);

    printf("Max between 20 and 10 is %d\n", MAX(10, 20));

    if (access("/Users/zkingcobra/Projects/CLionProjects/LearnC", F_OK) == 0) {
        printf("目录存在\n");
    }

    if (access("/Users/zkingcobra/Projects/CLionProjects/LearnC", R_OK) == 0) {
        printf("目录有可读权限\n");
    }

    if (access("/Users/zkingcobra/Projects/CLionProjects/LearnC", W_OK) == 0) {
        printf("目录有可写权限\n");
    }

    if (access("/Users/zkingcobra/Projects/CLionProjects/LearnC", X_OK) == 0) {
        printf("目录有执行权限\n");
    }



    return 0;
}